home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1993 / Internet Info CD-ROM (Walnut Creek) (1993).iso / networking / ip / ka9q / osrc.arc / NETROM.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-17  |  5.7 KB  |  174 lines

  1. #ifndef    NR3HLEN
  2. #include "iface.h"
  3. #include "ax25.h"
  4.  
  5. /* net/rom support definitions
  6.  * Dan Frank, W9NK
  7.  */
  8.  
  9. #define NR3HLEN        15    /* length of a net/rom level 3 hdr, */
  10. #define NR3DLEN        241    /* max data size in net/rom l3 packet */
  11. #define NR3NODESIG    0xff    /* signature for nodes broadcast */
  12. #define NR3NODEHL    7    /* nodes bc header length */
  13.  
  14. #define NRNUMIFACE    10    /* number of interfaces associated */
  15.                 /* with net/rom network layer      */
  16. #define NRNUMCHAINS    17    /* number of chains in the */
  17.                 /* neighbor and route hash tables */
  18. #define NRRTDESTLEN    21    /* length of destination entry in */
  19.                 /* nodes broadcast */
  20. #define NRDESTPERPACK    11    /* maximum number of destinations per */
  21.                 /* nodes packet */
  22.  
  23. /* Internal representation of net/rom network layer header */
  24. struct nr3hdr {
  25.     struct ax25_addr source ;    /* callsign of origin node */
  26.     struct ax25_addr dest ;        /* callsign of destination node */
  27.     unsigned ttl ;                /* time-to-live */
  28. } ;
  29.  
  30. /* Internal representation of net/rom routing broadcast destination */
  31. /* entry */
  32. struct nr3dest {
  33.     struct ax25_addr dest ;        /* destination callsign */
  34.     char alias[7] ;            /* ident, upper case ASCII, blank-filled */
  35.     struct ax25_addr neighbor ;    /* best-quality neighbor */
  36.     unsigned quality ;        /* quality of route for this neighbor */
  37. } ;
  38.  
  39.  
  40. /* net/rom interface table entry */
  41. struct nriface {
  42.     struct iface *iface ;        /* pointer to ax.25 interface */
  43.     char alias[7] ;            /* alias for this interface's node */
  44.                     /* broadcasts */
  45.     unsigned quality ;        /* net/rom link quality estimate */
  46. } ;
  47.  
  48. /* net/rom neighbor table structure */
  49. struct nrnbr_tab {
  50.     struct nrnbr_tab *next ;    /* doubly linked list pointers */
  51.     struct nrnbr_tab *prev ;
  52.     char call[AXALEN*3] ;        /* call of neighbor + 2 digis max */
  53.     unsigned iface ;        /* offset of neighbor's port in */
  54.                     /* interface table */
  55.     unsigned refcnt ;        /* how many routes for this neighbor? */
  56. } ;
  57.  
  58. #define    NULLNTAB    (struct nrnbr_tab *)0
  59.  
  60.  
  61. /* A list of these structures is provided for each route table */
  62. /* entry.  They bind a destination to a neighbor node.  If the */
  63. /* list of bindings becomes empty, the route table entry is    */
  64. /* automatically deleted.                                       */
  65.  
  66. struct nr_bind {
  67.     struct nr_bind *next ;        /* doubly linked list */
  68.     struct nr_bind *prev ;
  69.     unsigned quality ;        /* quality estimate */
  70.     unsigned obsocnt ;        /* obsolescence count */
  71.     unsigned flags ;
  72. #define    NRB_PERMANENT    0x01        /* entry never times out */
  73. #define NRB_RECORDED    0x02        /* a "record route" entry */
  74.     struct nrnbr_tab *via ;        /* route goes via this neighbor */
  75. } ;
  76.  
  77. #define    NULLNRBIND    (struct nr_bind *)0
  78.  
  79.  
  80. /* net/rom routing table entry */
  81.  
  82. struct nrroute_tab {
  83.     struct nrroute_tab *next ;    /* doubly linked list pointers */
  84.     struct nrroute_tab *prev ;
  85.     char alias[7] ;            /* alias of node */
  86.     struct ax25_addr call ;        /* callsign of node */
  87.     unsigned num_routes ;        /* how many routes in bindings list? */
  88.     struct nr_bind *routes ;    /* list of neighbors */
  89.  
  90. } ;
  91.  
  92. #define    NULLNRRTAB    (struct nrroute_tab *)0
  93.  
  94.  
  95. /* The net/rom nodes broadcast filter structure */
  96. struct nrnf_tab {
  97.     struct nrnf_tab *next ;        /* doubly linked list */
  98.     struct nrnf_tab *prev ;
  99.     struct ax25_addr neighbor ;    /* call of neighbor to filter */
  100.     unsigned iface ;        /* filter on this interface */
  101. } ;
  102.  
  103. #define    NULLNRNFTAB    (struct nrnf_tab *)0
  104.  
  105.  
  106. /* The interface table */
  107. extern struct nriface Nrifaces[NRNUMIFACE] ;
  108.  
  109. /* How many interfaces are in use */
  110. extern unsigned Nr_numiface ;
  111.  
  112. /* The neighbor hash table (hashed on neighbor callsign) */
  113. extern struct nrnbr_tab *Nrnbr_tab[NRNUMCHAINS] ;
  114.  
  115. /* The routes hash table (hashed on destination callsign) */
  116. extern struct nrroute_tab *Nrroute_tab[NRNUMCHAINS] ;
  117.  
  118. /* The nodes broadcast filter table */
  119. extern struct nrnf_tab *Nrnf_tab[NRNUMCHAINS] ;
  120.  
  121. /* filter modes: */
  122. #define    NRNF_NOFILTER    0    /* don't filter */
  123. #define    NRNF_ACCEPT    1    /* accept broadcasts from stations in list */
  124. #define    NRNF_REJECT    2    /* reject broadcasts from stations in list */
  125.  
  126. /* The filter mode */
  127. extern unsigned Nr_nfmode ;
  128.  
  129. /* The time-to-live for net/rom network layer packets */
  130. extern unsigned Nr_ttl ;
  131.  
  132. /* The obsolescence count initializer */
  133. extern unsigned Obso_init ;
  134.  
  135. /* The threshhold at which routes becoming obsolete are not broadcast */
  136. extern unsigned Obso_minbc ;
  137.  
  138. /* The quality threshhold below which routes in a broadcast will */
  139. /* be ignored */
  140. extern unsigned Nr_autofloor ;
  141.  
  142. /* Whether we want to broadcast the contents of our routing
  143.  * table, or just our own callsign and alias:
  144.  */
  145. extern unsigned Nr_verbose ;
  146.  
  147. /* The maximum number of routes maintained for a destination. */
  148. /* If the list fills up, only the highest quality routes are  */
  149. /* kept.  This limiting is done to avoid possible over-use of */
  150. /* memory for routing tables in closely spaced net/rom networks. */
  151. extern unsigned Nr_maxroutes ;
  152.  
  153. /* The netrom pseudo-interface */
  154. extern struct iface *Nr_iface ;
  155.  
  156. /* Functions */
  157. extern int ntohnr3(struct nr3hdr *, struct mbuf **) ;
  158. extern struct mbuf *htonnr3(struct nr3hdr *) ;
  159. extern struct nrroute_tab *find_nrroute(struct ax25_addr *) ;
  160. extern struct nrnbr_tab *find_nrnbr(struct ax25_addr *, unsigned) ;
  161. extern struct nrnf_tab *find_nrnf(struct ax25_addr *, unsigned) ;
  162. extern int nr_routeadd(char *, struct ax25_addr *, unsigned,
  163.                        unsigned, char *, unsigned, unsigned) ;
  164. extern int nr_routedrop(struct ax25_addr *, struct ax25_addr *, unsigned) ;
  165. extern int nr_nfadd(struct ax25_addr *, unsigned) ;
  166. extern int nr_nfdrop(struct ax25_addr *, unsigned) ;
  167. extern char *nr_getroute(struct ax25_addr *) ;
  168. extern int ntohnrdest(struct nr3dest *,struct mbuf **) ;
  169. extern struct mbuf *htonnrdest(struct nr3dest *) ;
  170.  
  171. #endif    /* NR3HLEN */
  172.  
  173.  
  174.